#ifndef CAMERATHREAD_H
#define CAMERATHREAD_H

#include <QThread>
#include <QMutex>
#include "d435Camera.h"
#include "orb336LCamera.h"
#include <iostream>
#include <memory>

class CameraThread : public QThread
{
    Q_OBJECT
public:
    explicit CameraThread(QObject *parent = nullptr);
    ~CameraThread();

    void startCamera();
    void stopCamera();
    void setProcessing(bool enable);

    // 1: realsensed435, 2: orb336
    void CameraInit(int index);


signals:
    void frameReady(const QImage &image);

protected:
    void run() override;

private:
    QMutex m_mutex;
    bool m_stop = false;
    bool m_process = false;

    int m_cameraIndex;

    std::unique_ptr<D435Camera> m_d435Camera;
    std::unique_ptr<orb336LCamera> m_orb336l;
};


#endif // CAMERATHREAD_H
